package ar.fiuba.tp7552.buildadmin.webactions;

import org.apache.commons.lang.StringUtils;

import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.validators.FieldValidatorSupport;

public class RequiredField extends FieldValidatorSupport {

	public void validate(Object object) throws ValidationException {
	 
		String fieldName = getFieldName();
		Object value = this.getFieldValue(fieldName, object);

		if (value == null || StringUtils.isEmpty(value.toString()))
			addFieldError(fieldName, object);
	}
}